"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.UserModel = void 0;
const ClubDao_1 = require("../../hall_server/dao/ClubDao");
class UserModel {
    constructor() {
        this.coins = 0;
        this.diamond = 0;
        this.room_id = 0;
    }
    json2Model(data) {
        this.userid = data.userid;
        this.account = data.account;
        this.nick_name = data.nick_name;
        this.sex = data.sex;
        this.headimg = data.headimgurl;
    }
    resource2Model(data) {
        this.coins = data["coins"];
        this.diamond = data["diamond"];
    }
    static db2Model(data) {
        let model = new UserModel();
        model.json2Model(data);
        return model;
    }
    destroy() {
    }
    getClub(clubid) {
        return __awaiter(this, void 0, void 0, function* () {
            let club = yield ClubDao_1.ClubDao.get_club_simple(this.userid, clubid);
            return club;
        });
    }
    model2proto() {
        let userinfo = {
            userId: this.userid,
            userName: this.nick_name,
            userPhoto: this.headimg,
            sex: this.sex,
            coins: this.coins,
            diamond: this.diamond
        };
        return userinfo;
    }
}
exports.UserModel = UserModel;
